package com.bigbigrain.jiagou.design.command.impl;

import com.bigbigrain.jiagou.design.command.Command;
import com.bigbigrain.jiagou.design.command.LightReceiver;

/**
 * @description: 关灯命令
 * @author: B1gB1gRA1n
 * @create: 2020-6-1 09:24
 **/
public class LightOffCommand implements Command {
    /**
     * 聚合 lightreceiver对象
     */
    LightReceiver light;

    public LightOffCommand(LightReceiver light) {
        this.light = light;
    }

    @Override
    public void execute() {
        //调用接收者的方法
        light.off();
    }

    @Override
    public void undo() {
        //调用接收者的方法
        light.on();
    }
}
